﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin.master" AutoEventWireup="true"
    CodeFile="TLXuatKho.aspx.cs" Inherits="TLXuatKho" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <script type="text/javascript">
        function CallPrint(strid) {
            var prtContent = document.getElementById(strid);
            prtContent.style.visibility = 'visible'
            var WinPrint = window.open('', '', 'letf=0,top=0,width=1200px,height=650px,toolbar=0,scrollbars=0,status=0');
            WinPrint.document.write(prtContent.innerHTML);
            WinPrint.document.close();
            WinPrint.focus();
            WinPrint.print();
            WinPrint.close();
            prtContent.style.visibility = 'hidden'
        }
    </script>
    <style type="text/css">
        #NhapKho
        {
            visibility: hidden;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:UpdatePanel ID="up1" runat="server">
        <ContentTemplate>
            <div class="panel panel-success margin">
                <div class="panel-heading">
                    <h3 class="panel-title">
                        Thiết lập xuất kho</h3>
                </div>
                <div class="panel-body">
                    <table width="100%">
                        <tr>
                            <td colspan="6">
                                <asp:GridView ID="GV1" Visible="true" AutoGenerateColumns="false" runat="server"
                                    BackColor="White" Font-Size="14px" Width="100%" BorderColor="#CCCCCC" EmptyDataText="Không có dữ liệu nào"
                                    BorderStyle="None" BorderWidth="1px" CellPadding="3" EnableModelValidation="True"
                                    OnRowDeleting="gv_RowDeleting">
                                    <Columns>
                                        <asp:BoundField DataField="RowNumber" HeaderText="STT" HeaderStyle-Width="50px" HeaderStyle-HorizontalAlign="Center"
                                            ItemStyle-HorizontalAlign="Center"></asp:BoundField>
                                        <asp:TemplateField HeaderText="Ngày tháng" ItemStyle-HorizontalAlign="Center">
                                            <ItemTemplate>
                                                <asp:TextBox ID="txtngaythang" runat="server" Width="98%"></asp:TextBox>
                                                <cc1:CalendarExtender PopupPosition="BottomRight" ID="CalendarExtender3" runat="server"
                                                    TargetControlID="txtngaythang" Format="dd/MM/yyyy">
                                                </cc1:CalendarExtender>
                                                <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender3" runat="server" FilterType="Custom,Numbers"
                                                    TargetControlID="txtngaythang" ValidChars="/" />
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Nhóm vật liệu" ItemStyle-HorizontalAlign="Center">
                                            <ItemTemplate>
                                                <asp:DropDownList CssClass="form-control" AppendDataBoundItems="true" Style="line-height: 30px;"
                                                    DataTextField="TenNhomVatTu" DataValueField="IDs" ID="drnhomvatlieu" DataSourceID="objnhomvatlieu"
                                                    Width="95%" runat="server">
                                                    <asp:ListItem>Chọn nhóm vật liệu</asp:ListItem>
                                                </asp:DropDownList>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Loại vật liệu" ItemStyle-HorizontalAlign="Center">
                                            <ItemTemplate>
                                                <asp:DropDownList CssClass="form-control" AppendDataBoundItems="true" Style="line-height: 30px;"
                                                    DataTextField="TenLoaiVL" DataValueField="IDs" ID="drloaivatlieu" DataSourceID="objloaivatlieu"
                                                    Width="95%" runat="server">
                                                    <asp:ListItem>Chọn loại vật liệu</asp:ListItem>
                                                </asp:DropDownList>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Đơn vị" ItemStyle-HorizontalAlign="Center">
                                            <ItemTemplate>
                                                <asp:DropDownList CssClass="form-control" AppendDataBoundItems="true" Style="line-height: 30px;"
                                                    DataTextField="donvi" DataValueField="IDs" ID="dldonvi" DataSourceID="objdonvi"
                                                    Width="95%" runat="server">
                                                    <asp:ListItem>Chọn đơn vị</asp:ListItem>
                                                </asp:DropDownList>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Số lượng" ItemStyle-HorizontalAlign="Center">
                                            <ItemTemplate>
                                                <asp:TextBox ID="txtsoluong" runat="server" Width="98%"></asp:TextBox>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Đơn giá" ItemStyle-HorizontalAlign="Center">
                                            <ItemTemplate>
                                                <asp:TextBox ID="txtdongia" runat="server" Width="98%"></asp:TextBox>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Thành tiền" ItemStyle-HorizontalAlign="Center">
                                            <ItemTemplate>
                                                <asp:TextBox ID="txtthanhtien" runat="server" Width="98%"></asp:TextBox>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Đối tượng" ItemStyle-HorizontalAlign="Center">
                                            <ItemTemplate>
                                                <asp:DropDownList CssClass="form-control" Style="line-height: 30px;" DataTextField="doituongchi"
                                                    DataValueField="IDs" ID="dldoituong" DataSourceID="objdoituong" AppendDataBoundItems="true"
                                                    Width="95%" runat="server">
                                                    <asp:ListItem>Chọn đối tượng chi</asp:ListItem>
                                                </asp:DropDownList>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Mã thiết bị" ItemStyle-HorizontalAlign="Center">
                                            <ItemTemplate>
                                                <asp:DropDownList CssClass="form-control" AppendDataBoundItems="true" Style="line-height: 30px;"
                                                    DataTextField="mathietbi" DataValueField="mathietbi" ID="drmathietbi" DataSourceID="objmathietbi"
                                                    Width="95%" runat="server">
                                                    <asp:ListItem>Chọn mã thiết bị</asp:ListItem>
                                                </asp:DropDownList>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Có VAT" ItemStyle-HorizontalAlign="Center">
                                            <ItemTemplate>
                                                <asp:CheckBox ID="ckVAT" runat="server" Width="98%"></asp:CheckBox>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:CommandField HeaderText="Xóa" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="45px"
                                            ShowDeleteButton="True" DeleteText="Xóa" />
                                    </Columns>
                                    <FooterStyle BackColor="#6EA1C0" ForeColor="#000066" />
                                    <HeaderStyle BackColor="#6EA1C0" Font-Bold="True" ForeColor="White" Height="40px"
                                        HorizontalAlign="Center" VerticalAlign="Middle" />
                                    <PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
                                    <RowStyle ForeColor="#000066" Height="30px" />
                                    <SelectedRowStyle BackColor="#F1F1F1" Font-Bold="True" />
                                </asp:GridView>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="6" style="padding: 10px">
                                <asp:Button ID="btnAdd" ValidationGroup="add" runat="server" Text="Thêm vật liệu"
                                    CssClass="btn btn-info" OnClick="btnAdd_Click" />
                            </td>
                        </tr>
                        <tr>
                            <td colspan="6">
                                <asp:Button ID="btnSave" ValidationGroup="Them" runat="server" Style="margin-left: 5px;"
                                    Text="Lưu lại" CssClass="btn btn-primary" OnClick="btnSave_Click1" />
                                <asp:Button ID="btncapnhat" runat="server" Text="Cập nhật" CssClass="btn btn-info"
                                    Visible="false" />
                                <asp:Button ID="btnCancel" runat="server" Text="Nhập mới" CssClass="btn btn-warning"
                                    OnClick="btnCancel_Click" />
                            </td>
                        </tr>
                    </table>
                    <asp:ObjectDataSource ID="objdoituong" runat="server" SelectMethod="GetDoiTuong"
                        TypeName="clsXuLy"></asp:ObjectDataSource>
                    <asp:ObjectDataSource ID="objdonvi" runat="server" SelectMethod="GetDonVi" TypeName="clsXuLy">
                    </asp:ObjectDataSource>
                    <asp:ObjectDataSource ID="objnhomvatlieu" runat="server" SelectMethod="GetNhomVatLieu"
                        TypeName="clsXuLy"></asp:ObjectDataSource>
                    <asp:ObjectDataSource ID="objloaivatlieu" runat="server" SelectMethod="GetLoaiVatLieu"
                        TypeName="clsXuLy"></asp:ObjectDataSource>
                    <asp:ObjectDataSource ID="objmathietbi" runat="server" SelectMethod="GetMaThietBi"
                        TypeName="clsXuLy"></asp:ObjectDataSource>
                    <asp:ValidationSummary ID="ValidationSummary1" HeaderText="Bạn phải nhập các trường sau:"
                        ShowMessageBox="true" ValidationGroup="Them" ShowSummary="false" EnableClientScript="true"
                        runat="server" />
                </div>
            </div>
            <div style="margin: 5px;">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        Danh sách
                    </div>
                    <div style="margin-bottom: 5px;">
                        <div style="margin-bottom: 5px;">
                            <asp:DropDownList ID="dlThang" runat="server" Width="150px" AutoPostBack="true" OnSelectedIndexChanged="dlThang_SelectedIndexChanged"
                                CssClass="form-control">
                            </asp:DropDownList>
                            <asp:DropDownList ID="dlNam" runat="server" Width="110px" CssClass="form-control">
                            </asp:DropDownList>
                            <asp:TextBox ID="txtTuNgay" runat="server" placeholder="Từ ngày" Visible="true" Width="100px"
                                CssClass="form-control"></asp:TextBox>&nbsp;
                            <asp:TextBox ID="txtDenNgay" runat="server" placeholder="Đến ngày" AutoPostBack="true"
                                Visible="true" Width="100px" CssClass="form-control"></asp:TextBox>
                            <cc1:CalendarExtender ID="CalendarExtender11" runat="server" TargetControlID="txtTuNgay"
                                Format="dd/MM/yyyy">
                            </cc1:CalendarExtender>
                            <cc1:CalendarExtender ID="CalendarExtender111" runat="server" TargetControlID="txtDenNgay"
                                Format="dd/MM/yyyy">
                            </cc1:CalendarExtender>
                            <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender9" runat="server" FilterType="Custom,Numbers"
                                TargetControlID="txtTuNgay" ValidChars="/-" />
                            <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender10" runat="server" FilterType="Custom,Numbers"
                                TargetControlID="txtDenNgay" ValidChars="/-" />
                            <asp:DropDownList ID="dropNhanVien" DataTextField="TenLoaiVL" DataValueField="ids"
                                runat="server" Width="140px" CssClass="form-control">
                            </asp:DropDownList>
                            <asp:Button ID="btnXem" CssClass="btn btn-warning" runat="server" Text="Xem dữ liệu"
                                OnClick="btnXem_Click" />
                            <asp:Button ID="Button1" CssClass="btn btn-warning" runat="server" Text="In Xuất Kho"
                                OnClientClick="javascript:CallPrint('NhapKho')" />
                        </div>
                    </div>
                    <div style="width: 100%; overflow-x: auto; margin-top: 0px;" class="wrapper">
                        <asp:GridView ID="GV" runat="server" AutoGenerateColumns="false" BackColor="White"
                            BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="1" EmptyDataText="Không có dữ liệu nào"
                            EnableModelValidation="True" ShowFooter="false" Width="99%" CssClass="form-control withall"
                            OnRowCommand="GV_RowCommand">
                            <Columns>
                                <asp:TemplateField HeaderText="Xóa" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="50px"
                                    ItemStyle-Width="50px">
                                    <ItemTemplate>
                                        <asp:ImageButton ID="lbXoa" runat="server" Width="20px" Height="20px" ImageUrl="~/img/delete-24.png"
                                            OnClientClick="return confirm('Bạn chắc chắn muốn xóa ?')" CommandArgument='<%#Eval("IDs")%>'
                                            Text="Xóa" CommandName="Del" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="ngaythang" ItemStyle-CssClass="padding" HeaderText="Ngày tháng"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" />
                                <asp:BoundField DataField="TenNhomVatTu" ItemStyle-CssClass="padding" HeaderText="Nhóm vật tư"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" />
                                <asp:BoundField DataField="TenLoaiVL" ItemStyle-CssClass="padding" HeaderText="Loại Vật liệu"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" />
                                <asp:BoundField DataField="donvi" ItemStyle-CssClass="padding" HeaderText="Đơn vị"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Right" />
                                <asp:BoundField DataField="soluong" ItemStyle-CssClass="padding" HeaderText="Số lượng"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" />
                                <asp:BoundField DataField="dongia" ItemStyle-CssClass="padding" HeaderText="Đơn giá"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" />
                                <asp:BoundField DataField="thanhtien" ItemStyle-CssClass="padding" HeaderText="Thành tiền"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" />
                                <asp:BoundField DataField="mathietbi" ItemStyle-CssClass="padding" HeaderText="Mã thiết bị"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" />
                                <asp:BoundField DataField="DoiTuongChi" ItemStyle-CssClass="padding" HeaderText="Đối tượng"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" />
                            </Columns>
                            <FooterStyle BackColor="White" ForeColor="#000066" Font-Bold="True" HorizontalAlign="Left" />
                            <HeaderStyle BackColor="White" Font-Bold="True" ForeColor="Black" Height="30px" />
                            <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
                            <RowStyle BackColor="White" ForeColor="#000066" Height="30px" />
                            <SelectedRowStyle BackColor="Lavender" Font-Bold="false" />
                        </asp:GridView>
                        <div style="margin: 5px;">
                            <asp:Button ID="btnFirst" runat="server" Text="Đầu" CssClass="btn btn-primary" OnClick="btnFirst_Click" />
                            <asp:Button ID="btnPre" runat="server" Style="margin-left: 5px;" Text="Trước" CssClass="btn btn-primary"
                                OnClick="btnPre_Click" />
                            <asp:Button ID="btnNext" runat="server" Style="margin-left: 5px;" Text="Sau" CssClass="btn btn-warning"
                                OnClick="btnNext_Click" />
                        </div>
                        <center>
                            <div id="NhapKho">
                                <table>
                                    <tr>
                                        <td style="font-size: 15px;">
                                            CÔNG TY CPXD ĐỨC ANH
                                        </td>
                                        <td style="font-size: 20px;" colspan="2">
                                            <span style="margin: 70px;">Cộng hòa xã hội chủ nghĩa Việt Nam
                                        </td>
                                        <td>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="font-size: 15px;">
                                            <span style="margin: 5px;">CN BÊ TÔNG LÂM THAO</span>
                                        </td>
                                        <td style="font-size: 20px;" colspan="2">
                                            <span style="margin: 105px;">Độc lập – Tự do – Hạnh phúc</span>
                                        </td>
                                        <td colspan="2">
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                        </td>
                                        <td align="right" style="font-size: 20px;">
                                            Lâm Thao ngày......tháng.......năm......
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="3" align="center" style="font-size: 25px;">
                                            PHIẾU XUẤT KHO
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <br />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <br />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="3">
                                            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" BackColor="White"
                                                BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="1" EmptyDataText="Không có dữ liệu nào"
                                                EnableModelValidation="True" ShowFooter="false" Width="920px" CssClass="form-control withall"
                                                OnRowCommand="GV_RowCommand">
                                                <Columns>
                                                    <asp:BoundField DataField="ngaythang" ItemStyle-CssClass="padding" HeaderText="Ngày tháng"
                                                        HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" />
                                                    <asp:BoundField DataField="TenNhomVatTu" ItemStyle-CssClass="padding" HeaderText="Nhóm vật tư"
                                                        HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" />
                                                    <asp:BoundField DataField="TenLoaiVL" ItemStyle-CssClass="padding" HeaderText="Loại Vật liệu"
                                                        HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" />
                                                    <asp:BoundField DataField="donvi" ItemStyle-CssClass="padding" HeaderText="Đơn vị"
                                                        HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" />
                                                    <asp:BoundField DataField="soluong" ItemStyle-CssClass="padding" HeaderText="Số lượng"
                                                        HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" />
                                                    <asp:BoundField DataField="dongia" ItemStyle-CssClass="padding" HeaderText="Đơn giá"
                                                        HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" />
                                                    <asp:BoundField DataField="thanhtien" ItemStyle-CssClass="padding" HeaderText="Thành tiền"
                                                        HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" />
                                                    <asp:BoundField DataField="DoiTuongChi" ItemStyle-CssClass="padding" HeaderText="Xuất cho đối tượng"
                                                        HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" />
                                                    <asp:BoundField DataField="mathietbi" ItemStyle-CssClass="padding" HeaderText="Mã thiết bị"
                                                        HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" />
                                                </Columns>
                                                <FooterStyle BackColor="White" ForeColor="#000066" Font-Bold="True" HorizontalAlign="Left" />
                                                <HeaderStyle BackColor="White" Font-Bold="True" ForeColor="Black" Height="30px" />
                                                <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
                                                <RowStyle BackColor="White" ForeColor="#000066" Height="30px" />
                                                <SelectedRowStyle BackColor="Lavender" Font-Bold="false" />
                                            </asp:GridView>
                                        </td>
                                    </tr>
                                   <tr>
                                        <td align="center" colspan="3">
                                            <span style="margin-right: 200px;">Thủ kho</span> <span>Trưởng phòng hành chính tổng
                                                hợp</span> <span style="margin-left: 200px;">Giám đốc</span>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </center>
                    </div>
                </div>
                <asp:HiddenField ID="hdID" runat="server" />
                <asp:HiddenField ID="hdTuNgay" runat="server" />
                <asp:HiddenField ID="hdDenNgay" runat="server" />
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
